package org.linlinjava.litemall.db.service;

import org.linlinjava.litemall.db.dao.EjiaOpenCitysMapper;
import org.linlinjava.litemall.db.domain.EjiaOpenCitys;
import org.linlinjava.litemall.db.domain.EjiaOpenCitysExample;
import org.linlinjava.litemall.db.domain.LitemallAddressExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author houzb
 * @Description
 * @create 2021-04-02 17:11
 */
@Service
public class EjiaOpenCityService {

    @Autowired
    private EjiaOpenCitysMapper ejiaOpenCitysMapper;

    public List<EjiaOpenCitys> getList(){
        EjiaOpenCitysExample ejiaOpenCitysExample = new EjiaOpenCitysExample();
        return ejiaOpenCitysMapper.selectByExample(ejiaOpenCitysExample);
    }

    public int isOpen(String city) {
        EjiaOpenCitysExample ejiaOpenCitysExample = new EjiaOpenCitysExample();
        ejiaOpenCitysExample.or().andCityEqualTo(city);
        EjiaOpenCitys citys = ejiaOpenCitysMapper.selectOneByExample(ejiaOpenCitysExample);
        return citys != null ? 1 : 0;
    }

}
